SHELL = /bin/sh

CXX_SOURCES = llt_v4tov6.cc llt_v6tov4.cc llt_v4chksum.cc \
              llt_dropper.cc llt_v6mapper.cc llt_v4mapper.cc \
              llt_ipv4v6natpt.cc 
GEN_SOURCES = llt_v4tov6.hh llt_v6tov4.hh llt_v4chksum.hh \
              llt_dropper.hh llt_v6mapper.hh llt_v4mapper.hh \
              llt_ipv4v6natpt.hh llt_ipv4v6natpt_gen.cc

PPF_SOURCES = v4tov6.lp v6tov4.lp dropper.lp v4chksum.lp v6mapper.lp v4mapper.lp
MAIN_SOURCE = ipv4v6natpt.lp
ALL_SOURCES = $(PPF_SOURCES) $(MAIN_SOURCE) 

.SUFFIXES:
.SUFFIXES: .lp .cc .hh .o .lapp

TARGET_NAME = $(subst .lp,.ppa,$(MAIN_SOURCE))

LLT_ACTION = llt $(MAIN_SOURCE)

$(TARGET_NAME) : $(GEN_SOURCES) $(CXX_SOURCES)
	lpkg $(subst .lp,,$(ALL_SOURCES))

llt_ipv4v6natpt.hh : ipv4v6natpt.lp
	$(LLT_ACTION)

llt_ipv4v6natpt_gen.cc : ipv4v6natpt.lp
	$(LLT_ACTION)

llt_dropper.hh : dropper.lp
	$(LLT_ACTION)

llt_v4chksum.hh : v4chksum.lp
	$(LLT_ACTION)

llt_v4tov6.hh : v4tov6.lp
	$(LLT_ACTION)

llt_v6tov4.hh : v6tov4.lp
	$(LLT_ACTION)

llt_v6mapper.hh : v6mapper.lp
	$(LLT_ACTION)

llt_v4mapper.hh : v4mapper.lp
	$(LLT_ACTION)

.PHONY: clean all

all : $(TARGET_NAME)

clean :
	rm -rf *.lapp *.o $(GEN_SOURCES)
